home *** CD-ROM | disk | FTP | other *** search
- Path: news.erinet.com!usenet
- From: timb@erinet.com (Tim Berens)
- Newsgroups: comp.lang.c
- Subject: Re: Determining the length of an int in string form
- Date: Wed, 20 Mar 1996 20:45:48 GMT
- Organization: EriNet Online 513 436-9915
- Message-ID: <4ipd9k$ep8@news.erinet.com>
- References: <3146D058.DD7@cbm.com> <4i7uth$qph@inet-nntp-gw-1.us.oracle.com> <DoE38u.GIH@iquest.net> <DoGs5D.FFB@iquest.net>
- NNTP-Posting-Host: edlp116.erinet.com
- X-Newsreader: Forte Free Agent 1.0.82
-
- dlmiller@iquest.net (Doug Miller) wrote:
-
-
- >++] I have a variable of type int, and I would like to use the sprintf()
- >++] function to write this variable to a string. However, I want to
- >++] dynamically allocate the space for the string, and only malloc enough
- >++] space to hold the int.
- >+
- >+WHY ???
- >+
- >+Even a 32-bit int is only 9 characters at most, and that's *with* the sign. Why not just declare
- >+a string and be done with it? Is storage space that tight for you, that nine bytes matters?
- >+
-
- Maybe he needs to do this 50,000 times in a loop. 9 * 50,0000 bytes
- matters.
-
-